Previous Book Contents Book Index Next

Inside Macintosh: Mac OS 8 Toolbox Reference /
Chapter 2 - Control Manager Reference / Control Manager Functions
Handling Keyboard Focus /


SetKeyboardFocus

NEW WITH THE APPEARANCE MANAGER

Sets the current keyboard focus to a specified control part for a specified window.

pascal OSErr SetKeyboardFocus (
                     WindowPtr inWindow,
                     ControlHandle inControl,
                     ControlFocusPart inPart);
inWindow
On input, a pointer to the window containing the control that you wish to receive keyboard focus.
inControl
On input, a handle to the control that you wish to receive keyboard focus.
inPart
A part code specifying the part of a control which will receive keyboard focus. To clear a control's keyboard focus, pass kControlFocusNoPart. See "Handling Keyboard Focus".
function result
A result code; see "Result Codes". The result code errNoRootControl indicates that keyboard focus is unavailable because the window does not have an embedding hierarchy established. If the specified control doesn't support keyboard focus, errControlDoesntSupportFocus is returned
DISCUSSION
The SetKeyboardFocus function sets the keyboard focus to a specified control part. The control to receive keyboard focus can be deactivated or invisible. This permits you to set the focus for an item in a dialog box before the dialog box is displayed.

SEE ALSO
GetKeyboardFocus.

"Handling Keyboard Focus".

"Appearance Manager Gestalt Selector Constants".


Previous Book Contents Book Index Next

© Apple Computer, Inc.
8 JAN 1998